/*******************************************************************************
01_01: Make Figure 1

Replication code for "Culture and gender allocation of tasks: source country 
	characteristics and the division of non-market work among US immigrants" in
	Review of Economics of the Household

Authors: Francine Blau, Lawrence Kahn, Matthew Comey, Amanda Eng, Pamela 
	Meyerhofer, and Alexander Willen
	
Date: 10/16/2020

Description: This code generates Figure 1 from the paper

*******************************************************************************/

*Label countries
quietly do "$code/01_02_Label_Countries.do"

preserve

keep if immig==1

gen count=1
gen sex=female + 1

collapse (first) GGI abbrev (mean) nmw_total (sum) count [aw=newwt], by(country sex)

drop if GGI==.
drop if nmw_total==0

reshape wide nmw_total count, i(country GGI) j(sex)

*** A. Main Specification

gen nmw_gap = nmw_total2 - nmw_total1
lab var nmw_gap "Female - Male NMW"

gen count_tot = count1 + count2

*Drop countries with fewer than 30 observations
drop if count_tot<30
order country GGI nmw_gap count_tot

reg nmw_gap GGI
local b: display %3.2f _b[GGI]
local se: display %3.2f _se[GGI]


*Plot
scatter nmw_gap GGI, mlabel(abbrev) mcolor(black) mlabc(black) lcolor(black) msize(tiny) ///
	|| lfit nmw_gap GGI, graphregion(color(white)) bgcolor(white) ///
	title("", color(black)) ///
	ytit("Female - Male Weekly NMW") xtit("GGI") plotregion(margin(l+10 r+10)) ///
	ysize(4.5) xsize(6.5) ///
	lcolor(black) note("Fitted Line: {&beta} = `b', s.e. = `se'. Female - Male NMW is computed as mean female non-market work per week" "minus mean male non-market work per week, by country. The regression line weights all countries equally." "Countries with fewer than 30 ATUS observations were dropped.")

graph export "$figures/Figure_1.png", replace

restore